package day18.tarena.Thred;

import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JOptionPane;

public class Test implements ActionListener {
	
	
	public Test() {
		JFrame jf = new JFrame();
		jf.setLayout(new FlowLayout());
		JButton jb = new JButton("测试");
		jb.addActionListener(this); 
		jf.add(jb);
		jf.setSize(300, 200);
		jf.setVisible(true);
		jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
	}

	public void actionPerformed(ActionEvent arg0) {
		int choice = JOptionPane.showConfirmDialog(null, "对话提示内容");
		if (choice == JOptionPane.YES_OPTION) {
			System.exit(0);
		} else if (choice == JOptionPane.NO_OPTION) {

		}
	}

	public static void main(String[] args) {
		new Test();
	}
}